package com.qipay.admin.login;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

/**
 * Created by dong on 2015/11/17.
 */
@Configuration
public class PowerConfig extends WebMvcConfigurerAdapter {

    @Bean
    public AuthInterceptor localeInterceptor() {
        return new AuthInterceptor();
    }
    /**
     * 配置拦截器
     * @author lance
     * @param registry
     */
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(localeInterceptor()).addPathPatterns("/cp").addPathPatterns("/cp/*")
                .addPathPatterns("/proxy").addPathPatterns("/proxy/*")
                .addPathPatterns("/order").addPathPatterns("/order/*")
                .addPathPatterns("/sp").addPathPatterns("/sp/*")
                .addPathPatterns("/user").addPathPatterns("/user/*")
                .addPathPatterns("/sys").addPathPatterns("/sys/*")
                .addPathPatterns("/doc").addPathPatterns("/doc/*")
                .addPathPatterns("/stat").addPathPatterns("/stat/*")
                .addPathPatterns("/statement").addPathPatterns("/statement/*")
                .addPathPatterns("/withdraw").addPathPatterns("/withdraw/*")
                .addPathPatterns("/auth").addPathPatterns("/auth/*")
                .addPathPatterns("/cp/").addPathPatterns("/cp/**")        ;
        //.addPathPatterns("/sys").addPathPatterns("/sys/*");
    }
}

